package com.hgy.plugin.rest;

import java.util.Arrays;
import java.util.List;

import com.hgy.common.utils.StringUtil;
import com.hgy.framework.helper.ConfigHelper;

/**
 * 从配置文件中获取相关数据
 * 
 * @author alone
 *
 */
public class RestConfig {

	public static boolean isLog(){
		return ConfigHelper.getBoolean(RestConstant.LOG);
	}
	
	public static boolean isJsonp(){
		return ConfigHelper.getBoolean(RestConstant.JSONP);
	}
	
	public static String getJsonpFunction(){
		return ConfigHelper.getString(RestConstant.JSONP_FUNCTION);
	}
	
	public static boolean isCors(){
		return ConfigHelper.getBoolean(RestConstant.CORS);
	}
	
	public static List<String> getCorsOriginList(){
		String corsOrigin = ConfigHelper.getString(RestConstant.CORS_ORIGIN);
		return Arrays.asList(StringUtil.splitString(corsOrigin, ","));
	}
}
